package com.chapter7.neibulei.demo11;

public class MyButton {
    private String name;
    private ActionListener actionListener = null;

    public MyButton(String name) {
        this.name = name;
    }

    public MyButton(){
        this("noName");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void RegisterListener(ActionListener actionListener){
        this.actionListener=actionListener;
    }

    public void click(){
        if (actionListener!=null){
            actionListener.doAction(new ClickEvent(this));
        }
    }

}
